<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE>
<html>
<head>
<base href="<%=basePath%>">
<title></title>
<link rel="stylesheet" href="layui/css/layui.css" type="text/css"></link>
</head>
<body>
	<div style="margin: 0 auto;width:800px; border: 1px solid red;">
		<form action="bookInfo/findAll">
			<div style="height: 100px;"></div>
			<div style="text-align: center;">
				<h1>图书借阅系统</h1>
			</div>
			<!-- 导航 -->
			<div>
				<div style="float: left">
					<label>图书分类：</label> <select name="typeName">
						<option value="0">--请选择--</option>
						<option value="2"
							<c:if test="${2==typeName}"> selected='selected'</c:if>>
							小说</option>
						<option value="1"
							<c:if test="${1==typeName}"> selected='selected'</c:if>>科技</option>
						<option value="3"
							<c:if test="${3==typeName}"> selected='selected'</c:if>>文学</option>
						<option value="4"
							<c:if test="${4==typeName}"> selected='selected'</c:if>>少儿</option>
					</select>
				</div>
				<div style="float:left">
					图书名称：<input type="text" name="likeName" value="${likeName}">
				</div>
				<div style="float:left">
					<label>是否借阅</label> <select name="isBorrow">
						<option value="-1">--清选择--</option>
						<option value="1"
							<c:if test="${1==isBorrow}"> selected='selected'</c:if>>可借阅</option>
						<option value="0"
							<c:if test="${0==isBorrow}"> selected='selected'</c:if>>不可借阅</option>
					</select>
				</div>
				<div style="float:left">
					<input type="submit" value="查询">
				</div>
				<div style="clear: both;"></div>
			</div>
		</form>
		<!-- 显示用户信息 -->
		<div style="float:right; width: 200px;">
			<!-- 点 相当于 map.get(key)-->
			当前用户：${users.user_code } <a href="exitLoginAction">退出</a>
		</div>
		<div style="clear:both;"></div>
		<!-- 显示图书信息 -->
		<div>
			<table>
				<tr>
					<td width="100px">图书编号</td>
					<td width="100px">图书分类</td>
					<td width="100px">图书名称</td>
					<td width="100px">作者</td>
					<td width="100px">出版社</td>
					<td width="100px">操作</td>
				</tr>
				<c:forEach items="${list }" var="map">
					<tr>
						<td width="100px">${map.book_code }</td>
						<td width="100px">${map.type_name }</td>
						<td width="100px">${map.book_name }</td>
						<td width="100px">${map.book_author }</td>
						<td width="100px">${map.publish_press }</td>
						<td><c:if test="${map.is_borrow ==1 }">
								<a href="updateByIdAction?bookId=${map.book_id}">可借阅</a>
							</c:if> <c:if test="${map.is_borrow ==0 }">
								<p style="color:red">已借阅</p>
							</c:if>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		
		<div id="demo1"></div>
	
	</div>
	<script type="text/javascript" src="layui/lay/dest/layui.all.js"></script>
	<script type="text/javascript">
		layui.use([ 'laypage', 'layer' ], function() {
			var laypage = layui.laypage, layer = layui.layer;
			
			var curr = ${indexPage};
			
			laypage({
				cont : 'demo1',
				pages : '${pageCount}',//总页数
				groups : 5,
				
				curr : curr || 1, //判断是否第一页
				
				jump : function(obj, first) {
					if (first != true) {
						//layer.msg('第' + obj.curr + '页');
						location.href = "bookInfo/findAll?indexPage=" + obj.curr;
						first = obj.curr;
					}
				}
			//连续显示分页数
			});
		});
	</script>
</body>
</html>
